import React from 'react';
import ReactDOM from "react-dom";
import { Router, browserHistory} from "react-router";

export const rootRoute={
  path:'/',
  getComponent(nextState,callback){
    require.ensure([],require=>{
      callback(null,require('../components/nav').default);
    },'nav');
  },
  indexRoute:{
    getComponent(nextState,callback){
      require.ensure([],require=>{
        callback(null,require('../components/examine').default);
      },'examine');
    }
  },
  childRoutes:[{
    path:'examine',
    getComponent(nextState,callback){
      require.ensure([],require=>{
        callback(null,require('../components/examine').default);
      },'examine');
     }
  },
  {
    path:'admin',
    getComponent(nextState,callback){
      require.ensure([],require=>{
        callback(null,require('../components/admin').default);
      },'admin');
    }
  },
  {
    path:'history',
    getComponent(nextState,callback){
      require.ensure([],require=>{
        callback(null,require('../components/history').default);
      },'history');
    }
  },
  {
    path:'feedback',
    getComponent(nextState,callback){
      require.ensure([],require=>{
        callback(null,require('../components/feedback').default);
      },'feedback')
    }
  }
]
};

ReactDOM.render(
    <Router history={browserHistory} routes={rootRoute} />
  , document.getElementById('root')
);